/**
 * 
 */
package tests;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.google.common.collect.ArrayListMultimap;

import reit.main.Asset;
import reit.main.AssetContent;
import reit.main.Location;
import reit.main.Status;

/**
 * @author Mordechai
 *
 */
public class AssetTest {
	private Asset toTest; 
	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		
		ArrayListMultimap<String, AssetContent> assetContentContainer = ArrayListMultimap.create();
		assetContentContainer.put("Closet1", new AssetContent("Closet1", 40));
		assetContentContainer.put("Closet2", new AssetContent("Closet2", 30));
		assetContentContainer.put("Closet3", new AssetContent("Closet3", 10));
		assetContentContainer.put("Closet4", new AssetContent("Closet4", 70));
		assetContentContainer.put("Closet5", new AssetContent("Closet5", 50));
		toTest = new Asset("Name","Type",new Location(3.0,3.0),(byte) 5,(byte) 90,assetContentContainer ) ;
		
	}

	/**
	 * @throws java.lang.Exception
	 */
	@After
	public void tearDown() throws Exception {
	}

	/**
	 * Test method for {@link reit.main.Asset#getSize()}.
	 */
	@Test
	public void testGetSize() {
		assertEquals(5, toTest.getSize(),0);
	}

	/**
	 * Test method for {@link reit.main.Asset#getType()}.
	 */
	@Test
	public void testGetType() {
		assertEquals("Type", toTest.getType());
	}

	/**
	 * Test method for {@link reit.main.Asset#getStatus()}.
	 */
	@Test
	public void testGetStatus() {
		assertEquals(Status.AVAILABLE, toTest.getStatus());
	}

	/**
	 * Test method for {@link reit.main.Asset#setStatusTo(reit.main.Status)}.
	 */
	@Test
	public void testSetStatusTo() {
		toTest.setStatusTo(Status.BOOKED);
		assertEquals(Status.BOOKED, toTest.getStatus());
	}

	/**
	 * Test method for {@link reit.main.Asset#getName()}.
	 */
	@Test
	public void testGetName() {
		assertEquals("Name", toTest.getName());
	}

	/**
	 * Test method for {@link reit.main.Asset#getLocation()}.
	 */
	@Test
	public void testGetLocation() {
		assertEquals(new Location(3.0,3.0),toTest.getLocation());
	}

	/**
	 * Test method for {@link reit.main.Asset#getDistance(reit.main.Location)}.
	 */
	@Test
	public void testGetDistance() {
		assertEquals(3,toTest.getDistance(new Location(3.0,0.0)),0);
	}

	/**
	 * Test method for {@link reit.main.Asset#getCostPerNight()}.
	 */
	@Test
	public void testGetCostPerNight() {
		assertEquals(90, toTest.getCostPerNight(),0); // TODO
	}

	/**
	 * Test method for {@link reit.main.Asset#getAssetContents()}.
	 */
	@Test
	public void testGetAssetContents() {
		ArrayListMultimap<String, AssetContent> testContainer = toTest.getAssetContents();
		assertEquals("Closet1",testContainer.get("Closet1").get(0).getName());
		assertEquals("Closet2",testContainer.get("Closet2").get(0).getName());
		assertEquals("Closet3",testContainer.get("Closet3").get(0).getName());
		assertEquals("Closet4",testContainer.get("Closet4").get(0).getName());
		assertEquals("Closet5",testContainer.get("Closet5").get(0).getName());
	}

}
